<?php
/**
 * Created by PhpStorm.
 * User: 84071
 * Date: 2018-02-23
 * Time: 9:51
 */
namespace app\Common\validate;
use think\Validate;
class UserAddress extends Validate{
    protected $rule =   [
        'uid'  => 'require|number',

        'adduname'  => 'require',
        'phone'  => 'require|regex:/^1[34578]{1}[0-9]{9}$/',
        'zipcode'  => 'number|length=6',

        'address'  => 'require',

        '__token__' => 'token',
    ];

    protected $message  =   [
        'uid.require' => '请先登录！',
        'uid.number' => '请先登录！',

        'adduname.require' => '姓名不得为空！',
        'phone.require' => '手机不得为空！',
        'phone.regex' => '手机填写错误！',
        'zipcode.number' => '邮编填写错误！',
        'zipcode.length' => '邮编填写错误！',

        'address.require' => '请填写详细地址！',

        '__token__.token' => '已超时，请重试！',

    ];
    protected $scene = [
        'add' => ['uid','address'],
    ];
}